<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let worker = new Worker('01-webwork.js');

        worker.postMessage('hello world');

        worker.onmessage = function (e) {  
            console.log(e.data);
        }

        // 关掉woker
        // 如果不手动关闭，就会一直在其他线程运行
        // worker.terminate();
    </script>
</body>
</html>